package com.dengxingxing.ssm.controller;

import com.dengxingxing.ssm.entity.Book;
import com.dengxingxing.ssm.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author DELL
 */
@Controller
@RequestMapping("book")
public class BookController {
    @Autowired
    private BookService bookService;
    @RequestMapping("list")
    public String list(Model model){
        List<Book> books = bookService.findAllBooks();
        model.addAttribute("list",books);
        return "book/list";
    }
}
